import { http } from '@/utils/http/axios';
import { RequestEnum } from "@/enums/httpEnum";

/**
 * description: 生成授权码
 */
export function getOauthCode(business) {
  return http.request(
    {
      url: `/wx/genera/oauth/code/${business}`,
      method: RequestEnum.GET
    }
  );
}

/**
 * description: 取消授权码授权
 */
export function cancelOauthCode(business, code) {
  return http.request(
    {
      url: `/wx/cancel/oauth/${business}/${code}`,
      method: RequestEnum.DELETE
    }
  );
}

/**
 * description: 轮询是否授权
 */
export function pollingOauth(business, code) {
  return http.request(
    {
      url: `/wx/polling/oauth/${business}/${code}`,
      method: RequestEnum.GET
    },
    {
      isReturnNativeResponse: true,
    }
  );
}
